<template>
	<view v-if="indexData" class="wrapper">
		<view class="data-box">
			<view class="data-box-tit">
				订单统计
			</view>
			<view class="data-box-table ">
				<view class="data-box-table-li border-bot">
					<view class="data-box-table-l">
						事项
					</view>
					<view class="data-box-table-l">
						说明
					</view>
				</view>
				<view class="data-box-table-li border-bot">
					<view class="data-box-table-l">
						销售总额
					</view>
					<view class="data-box-table-l">
						￥{{indexData.order.orderTotal?indexData.order.orderTotal:0}}
					</view>
				</view>
				<view class="data-box-table-li border-bot">
					<view class="data-box-table-l">
						今日销售额
					</view>
					<view class="data-box-table-l">
						￥{{indexData.order.today[0].todayprice?indexData.order.today[0].todayprice:0}}
					</view>
				</view>
				<view class="data-box-table-li border-bot">
					<view class="data-box-table-l">
						今日订单数
					</view>
					<view class="data-box-table-l">
						{{indexData.order.today[0].todaytotal?indexData.order.today[0].todaytotal:0}}
					</view>
				</view>
				<view class="data-box-table-li border-bot">
					<view class="data-box-table-l">
						本周销售额
					</view>
					<view class="data-box-table-l">
						￥{{indexData.order.thisweek[0].thisweekprice?indexData.order.thisweek[0].thisweekprice:0}}
					</view>
				</view>
				<view class="data-box-table-li border-bot">
					<view class="data-box-table-l">
						本周订单数
					</view>
					<view class="data-box-table-l">
						{{indexData.order.thisweek[0].thisweektotal?indexData.order.thisweek[0].thisweektotal:0}}
					</view>
				</view>
				<view class="data-box-table-li border-bot">
					<view class="data-box-table-l">
						本月销售额
					</view>
					<view class="data-box-table-l">
						￥{{indexData.order.thismonth[0].thismonthprice?indexData.order.thismonth[0].thismonthprice:0}}
					</view>
				</view>
				<view class="data-box-table-li">
					<view class="data-box-table-l">
						本月订单数
					</view>
					<view class="data-box-table-l">
						{{indexData.order.thismonth[0].thismonthtotal?indexData.order.thismonth[0].thismonthtotal:0}}
					</view>
				</view>
			</view>
			
			<view class="data-box-tit">
				客户统计
			</view>
			<view class="data-box-table ">
				<view class="data-box-table-li border-bot">
					<view class="data-box-table-l">
						事项
					</view>
					<view class="data-box-table-l">
						说明
					</view>
				</view>
				<view class="data-box-table-li border-bot">
					<view class="data-box-table-l">
						今日新增客户数
					</view>
					<view class="data-box-table-l">
						{{indexData.user.today}}
					</view>
				</view>
				<view class="data-box-table-li border-bot">
					<view class="data-box-table-l">
						本周新增客户总数
					</view>
					<view class="data-box-table-l">
						{{indexData.user.Thisweek}}
					</view>
				</view>
				<view class="data-box-table-li border-bot">
					<view class="data-box-table-l">
						本月新增客户总数
					</view>
					<view class="data-box-table-l">
						{{indexData.user.thismonth}}
					</view>
				</view>
				<view class="data-box-table-li">
					<view class="data-box-table-l">
						客户总数
					</view>
					<view class="data-box-table-l">
						{{indexData.user.userTotal}}
					</view>
				</view>
			</view>
		</view>
		<!-- 提示窗 -->
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				imgUrl:'',
				num:Math.random(),
				id:0,
				indexData:null
			}
		},
		onLoad(e) {
			// this.id = e.id
			// this.id = 9
		},
		onShow(){
			this.imgUrl = this.api.imgUrl
			this.getData()
		},
		methods: {
			getData(){
				this.api._post('User/getStoreData').then(res=>{
					console.log(res)
					this.indexData = res.data
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	@import url('../../common/common.css');
	.wrapper {
		position: absolute;
		top: 0;
		left: 0;
		display: flex;
		flex-direction: column;
		width: 100%;
		min-height: 100%;
		padding-bottom: 150upx;
		box-sizing: border-box;
		background:#F6F6F6;
	}
	.data-box{
		width: 100%;
		.data-box-tit{
			width: 90%;
			margin: 39upx auto 0;
			font-size:32upx;
			font-family:PingFang SC;
			font-weight:bold;
			color:rgba(51,51,51,1);
		}
		.data-box-table{
			margin:  23upx auto 0;
			width:690upx;
			padding:20upx 50upx;
			box-sizing: border-box;
			background:rgba(255,255,255,1);
			box-shadow:0px 0px 25upx 0px rgba(0, 0, 0, 0.08);
			border-radius:10upx;
			.data-box-table-li{
				width: 100%;
				display: flex;
				justify-content: flex-start;
				align-items: center;
			}
			.data-box-table-l,.data-box-table-l{
				width: 50%;
				padding: 19upx 0;
				font-size:28upx;
				font-family:PingFang SC;
				font-weight:500;
				color:rgba(51,51,51,1);
			}
			.font-bold{
				font-weight: bold;
			}
			.border-bot{
				border-bottom: 1upx solid #EEEEEE;
			}
		}
	}
	
</style>
